package q69_mySqrt;

public class Solution_3 {


    /**
     * 特殊的方法：利用幂函数转为对数计算
     */
    public int mySqrt(int x) {
        if (x == 0) {
            return 0;
        }
        int ans = (int) Math.exp(0.5 * Math.log(x));
        return (long) (ans + 1) * (ans + 1) <= x ? ans + 1 : ans;
    }


}
